<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="javax.sound.midi.SysexMessage"%>
<%@page import="java.net.URLEncoder"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'cookie01.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  <%//登陆后把登录信息保存在cookie里
  //	Cookie userCookie=new Cookie("usern",//URLEncoder.encode(request.getParameter("username"),"utf-8"));
 // 	Cookie passCookie=new Cookie("pass",request.getParameter("password"));
  //	response.addCookie(userCookie);
  //	response.addCookie(passCookie);
  	//response.sendRedirect(basePath+"user.jsp");
   %>
   welcome<br/>
   <!-- 当客户端不支持cookie时，可以用url重写这时sessionID就会作为参数跟在路径后面 -->
   <a href="<%=response.encodeUrl("index.jsp") %>">url重写</a>
   <%=request.getRemoteAddr() %>
  </body>
</html>
